// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the SOCKETCOMM_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// SOCKETCOMM_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef SOCKETCOMM_EXPORTS
#define SOCKETCOMM_API __declspec(dllexport)
#else
#define SOCKETCOMM_API __declspec(dllimport)
#endif

#include <time.h>



//call this before call any other functions
SOCKETCOMM_API int scInitialize();

//call this after socket call is finished
SOCKETCOMM_API int scUnInitialize();


//Socket server functions:

SOCKETCOMM_API HANDLE scStartServer(const char* strServer, const char* strPort);

//return connection handle which will be used by scSendMessage
//retun NULL if there is no message
SOCKETCOMM_API HANDLE scGetMessage(HANDLE hServer, LPBYTE pData, int &nLen);
SOCKETCOMM_API bool scSendMessage(HANDLE hConn, LPBYTE pData, int nLen);
SOCKETCOMM_API int scCloseServer(HANDLE hServer);



//Socket client functions:
SOCKETCOMM_API HANDLE scClientConnectTo(const char* strServer, const char* strPort);//,const char* strNative);
SOCKETCOMM_API bool   scClientSendMessage(HANDLE hClient, LPBYTE pData, int nLen);
SOCKETCOMM_API bool   scClientGetResponse(HANDLE hClient, LPBYTE pData, int &nLen, clock_t& clk);
SOCKETCOMM_API int scClientDisconnect(HANDLE hClient);


//some utility
SOCKETCOMM_API bool scGetLocalAddress(char* strAddress, UINT nSize);

